package projet.dao.jpa;

import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

public class JPAUtil {

	private static EntityManagerFactory entityManagerFactory;

	private static EntityManagerFactory buildEntityManagerFactory() {
		entityManagerFactory = Persistence.createEntityManagerFactory("my-pu");
		return entityManagerFactory;
	}
	
	public static EntityManagerFactory getEntityManagerFactory() {
		if (entityManagerFactory == null) buildEntityManagerFactory();
		return entityManagerFactory;
	}

}
